# -*- codeing = utf-8 -*-
# @Time : 2022/8/5 21:46
# @Author : ZN
# @Email : 747723508@qq.com
# @File : modelsMixin.py
# @Software: PyCharm
from django.db import models

B = True


class DatetimeModelMixin(models.Model):
    create_time = models.DateTimeField(auto_now_add=True, verbose_name='创建时间')
    update_time = models.DateTimeField(auto_now=True, verbose_name='更新时间')

    class Meta:
        abstract =True

class IsDeleteModelMixin(models.Model):
    is_delete = models.BooleanField(default=False, verbose_name='逻辑删除')

    def delete(self, using=None, keep_parents=False):
        self.is_delete = True
        self.save()

    class Meta:
        abstract =True

class ModelSetMixin(DatetimeModelMixin,IsDeleteModelMixin):
    class Meta:
        abstract = True
